home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / widget / nsGUIEvent.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-05-08  |  37.1 KB  |  1,152 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Makoto Kato  <m_kato@ga2.so-net.ne.jp>
  24.  *   Dean Tessman <dean_tessman@hotmail.com>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. #ifndef nsGUIEvent_h__
  41. #define nsGUIEvent_h__
  42.  
  43. #include "nsPoint.h"
  44. #include "nsRect.h"
  45. #include "nsEvent.h"
  46. #include "nsHashtable.h"
  47. #include "nsString.h"
  48.  
  49. // nsIDOMEvent contains a long enum which includes a member called ERROR,
  50. // which conflicts with something that Windows defines somewhere.
  51. // So, undefine it:
  52. #ifdef WIN32
  53. #undef ERROR
  54. #endif
  55. #include "nsIDOMKeyEvent.h"
  56.  
  57. class nsIRenderingContext;
  58. class nsIRegion;
  59. class nsIWidget;
  60. class nsIMenuItem;
  61. class nsIAccessible;
  62. class nsIContent;
  63. class nsIURI;
  64.            
  65. /**
  66.  * Event Struct Types
  67.  */
  68. #define NS_EVENT                           1
  69. #define NS_GUI_EVENT                       2
  70. #define NS_SIZE_EVENT                      3
  71. #define NS_SIZEMODE_EVENT                  4
  72. #define NS_ZLEVEL_EVENT                    5
  73. #define NS_PAINT_EVENT                     6
  74. #define NS_SCROLLBAR_EVENT                 7
  75. #define NS_INPUT_EVENT                     8
  76. #define NS_KEY_EVENT                       9
  77. #define NS_MOUSE_EVENT                    10
  78. #define NS_MENU_EVENT                     11
  79. #define NS_SCRIPT_ERROR_EVENT             12
  80. #define NS_TEXT_EVENT                     13
  81. #define NS_COMPOSITION_EVENT              14
  82. #define NS_RECONVERSION_EVENT             15
  83. #define NS_MOUSE_SCROLL_EVENT             16
  84. #define NS_SCROLLPORT_EVENT               18
  85. #define NS_MUTATION_EVENT                 19 // |nsMutationEvent| in content
  86. #define NS_ACCESSIBLE_EVENT               20
  87. #define NS_FORM_EVENT                     21
  88. #define NS_FOCUS_EVENT                    22
  89. #define NS_POPUP_EVENT                    23
  90. #define NS_APPCOMMAND_EVENT               24
  91. #define NS_POPUPBLOCKED_EVENT             25
  92. #define NS_BEFORE_PAGE_UNLOAD_EVENT       26
  93. #define NS_UI_EVENT                       27
  94. #define NS_QUERYCARETRECT_EVENT           28
  95. #define NS_PAGETRANSITION_EVENT               29
  96. #ifdef MOZ_SVG
  97. #define NS_SVG_EVENT                      30
  98. #define NS_SVGZOOM_EVENT                  31
  99. #endif // MOZ_SVG
  100.  
  101. // These flags are sort of a mess. They're sort of shared between event
  102. // listener flags and event flags, but only some of them. You've been
  103. // warned!
  104. #define NS_EVENT_FLAG_NONE                0x0000
  105. #define NS_EVENT_FLAG_INIT                0x0001
  106. #define NS_EVENT_FLAG_BUBBLE              0x0002
  107. #define NS_EVENT_FLAG_CAPTURE             0x0004
  108. #define NS_EVENT_FLAG_STOP_DISPATCH       0x0008
  109. #define NS_EVENT_FLAG_NO_DEFAULT          0x0010
  110. #define NS_EVENT_FLAG_CANT_CANCEL         0x0020
  111. #define NS_EVENT_FLAG_CANT_BUBBLE         0x0040
  112. #define NS_PRIV_EVENT_FLAG_SCRIPT         0x0080
  113. #define NS_EVENT_FLAG_NO_CONTENT_DISPATCH 0x0100
  114. #define NS_EVENT_FLAG_SYSTEM_EVENT        0x0200
  115. #define NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY 0x0400 // @see nsIDOM3Event::stopImmediatePropagation()
  116. #define NS_EVENT_FLAG_DISPATCHING         0x0800
  117.  
  118. #define NS_PRIV_EVENT_UNTRUSTED_PERMITTED 0x8000
  119.  
  120. #define NS_EVENT_CAPTURE_MASK             (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
  121. #define NS_EVENT_BUBBLE_MASK              (~(NS_EVENT_FLAG_INIT | NS_EVENT_FLAG_CAPTURE | NS_EVENT_FLAG_NO_CONTENT_DISPATCH))
  122.  
  123. // Flags for internalAppFlags
  124.  
  125. #define NS_APP_EVENT_FLAG_NONE      0x00000000
  126.  
  127. // Similar to NS_EVENT_FLAG_NO_DEFAULT, but it allows focus
  128. #define NS_APP_EVENT_FLAG_HANDLED   0x00000001
  129.  
  130. // True if the event came from a trusted source
  131. #define NS_APP_EVENT_FLAG_TRUSTED   0x00000002
  132.  
  133. #define NS_EVENT_TYPE_NULL                   0
  134.  
  135. /**
  136.  * GUI MESSAGES
  137.  */
  138.  //@{
  139. #define NS_EVENT_NULL                   0
  140.  
  141.  
  142. #define NS_WINDOW_START                 100
  143.  
  144. // Widget is being created
  145. #define NS_CREATE                       (NS_WINDOW_START)
  146. // Widget may be destroyed
  147. #define NS_XUL_CLOSE                    (NS_WINDOW_START + 1)
  148. // Widget is being destroyed
  149. #define NS_DESTROY                      (NS_WINDOW_START + 2)
  150. // Widget was resized
  151. #define NS_SIZE                         (NS_WINDOW_START + 3)
  152. // Widget size mode was changed
  153. #define NS_SIZEMODE                     (NS_WINDOW_START + 4)
  154. // Widget gained focus
  155. #define NS_GOTFOCUS                     (NS_WINDOW_START + 5)
  156. // Widget lost focus
  157. #define NS_LOSTFOCUS                    (NS_WINDOW_START + 6)
  158. // Widget got activated
  159. #define NS_ACTIVATE                     (NS_WINDOW_START + 7)
  160. // Widget got deactivated
  161. #define NS_DEACTIVATE                   (NS_WINDOW_START + 8)
  162. // top-level window z-level change request
  163. #define NS_SETZLEVEL                    (NS_WINDOW_START + 9)
  164. // Widget needs to be repainted
  165. #define NS_PAINT                        (NS_WINDOW_START + 30)
  166. // Key is pressed within a window
  167. #define NS_KEY_PRESS                    (NS_WINDOW_START + 31)
  168. // Key is released within a window
  169. #define NS_KEY_UP                       (NS_WINDOW_START + 32)
  170. // Key is pressed within a window
  171. #define NS_KEY_DOWN                     (NS_WINDOW_START + 33)
  172. // Window has been moved to a new location.
  173. // The events point contains the x, y location in screen coordinates
  174. #define NS_MOVE                         (NS_WINDOW_START + 34) 
  175.  
  176. // Tab control's selected tab has changed
  177. #define NS_TABCHANGE                    (NS_WINDOW_START + 35)
  178.  
  179. #define NS_OS_TOOLBAR                   (NS_WINDOW_START + 36)
  180.  
  181. // Menu item selected
  182. #define NS_MENU_SELECTED                (NS_WINDOW_START + 38)
  183.  
  184. // Form control changed: currently == combo box selection changed
  185. // but could be expanded to mean textbox, checkbox changed, etc.
  186. // This is a GUI specific event that does not necessarily correspond
  187. // directly to a mouse click or a key press.
  188. #define NS_CONTROL_CHANGE                (NS_WINDOW_START + 39)
  189.  
  190. // Indicates the display has changed depth
  191. #define NS_DISPLAYCHANGED                (NS_WINDOW_START + 40)
  192.  
  193. // Indicates a theme change has occurred
  194. #define NS_THEMECHANGED                 (NS_WINDOW_START + 41)
  195.  
  196. // Indicates a System color has changed. It is the platform
  197. // toolkits responsibility to invalidate the window to 
  198. // ensure that it is drawn using the current system colors.
  199. #define NS_SYSCOLORCHANGED              (NS_WINDOW_START + 42)
  200.  
  201. // Indicates a script error has occurred
  202. #define NS_SCRIPT_ERROR                 (NS_WINDOW_START + 50)
  203.  
  204. #define NS_RESIZE_EVENT                 (NS_WINDOW_START + 60)
  205. #define NS_SCROLL_EVENT                 (NS_WINDOW_START + 61)
  206.  
  207. #define NS_PLUGIN_ACTIVATE               (NS_WINDOW_START + 62)
  208.  
  209. #define NS_MOUSE_MESSAGE_START          300
  210. #define NS_MOUSE_MOVE                   (NS_MOUSE_MESSAGE_START)
  211. #define NS_MOUSE_LEFT_BUTTON_UP         (NS_MOUSE_MESSAGE_START + 1)
  212. #define NS_MOUSE_LEFT_BUTTON_DOWN       (NS_MOUSE_MESSAGE_START + 2)
  213. #define NS_MOUSE_MIDDLE_BUTTON_UP       (NS_MOUSE_MESSAGE_START + 10)
  214. #define NS_MOUSE_MIDDLE_BUTTON_DOWN     (NS_MOUSE_MESSAGE_START + 11)
  215. #define NS_MOUSE_RIGHT_BUTTON_UP        (NS_MOUSE_MESSAGE_START + 20)
  216. #define NS_MOUSE_RIGHT_BUTTON_DOWN      (NS_MOUSE_MESSAGE_START + 21)
  217. #define NS_MOUSE_ENTER                  (NS_MOUSE_MESSAGE_START + 22)
  218. #define NS_MOUSE_EXIT                   (NS_MOUSE_MESSAGE_START + 23)
  219. #define NS_MOUSE_LEFT_DOUBLECLICK       (NS_MOUSE_MESSAGE_START + 24)
  220. #define NS_MOUSE_MIDDLE_DOUBLECLICK     (NS_MOUSE_MESSAGE_START + 25)
  221. #define NS_MOUSE_RIGHT_DOUBLECLICK      (NS_MOUSE_MESSAGE_START + 26)
  222. #define NS_MOUSE_LEFT_CLICK             (NS_MOUSE_MESSAGE_START + 27)
  223. #define NS_MOUSE_MIDDLE_CLICK           (NS_MOUSE_MESSAGE_START + 28)
  224. #define NS_MOUSE_RIGHT_CLICK            (NS_MOUSE_MESSAGE_START + 29)
  225. #define NS_MOUSE_ACTIVATE               (NS_MOUSE_MESSAGE_START + 30)
  226. #define NS_MOUSE_ENTER_SYNTH            (NS_MOUSE_MESSAGE_START + 31)
  227. #define NS_MOUSE_EXIT_SYNTH             (NS_MOUSE_MESSAGE_START + 32)
  228.  
  229. #define NS_CONTEXTMENU_MESSAGE_START    500
  230. #define NS_CONTEXTMENU                  (NS_CONTEXTMENU_MESSAGE_START)
  231. #define NS_CONTEXTMENU_KEY              (NS_CONTEXTMENU_MESSAGE_START + 1)
  232.  
  233. #define NS_SCROLLBAR_MESSAGE_START      1000
  234. #define NS_SCROLLBAR_POS                (NS_SCROLLBAR_MESSAGE_START)
  235. #define NS_SCROLLBAR_PAGE_NEXT          (NS_SCROLLBAR_MESSAGE_START + 1)
  236. #define NS_SCROLLBAR_PAGE_PREV          (NS_SCROLLBAR_MESSAGE_START + 2)
  237. #define NS_SCROLLBAR_LINE_NEXT          (NS_SCROLLBAR_MESSAGE_START + 3)
  238. #define NS_SCROLLBAR_LINE_PREV          (NS_SCROLLBAR_MESSAGE_START + 4)
  239.  
  240. #define NS_STREAM_EVENT_START           1100
  241. #define NS_PAGE_LOAD                    (NS_STREAM_EVENT_START)
  242. #define NS_PAGE_UNLOAD                  (NS_STREAM_EVENT_START + 1)
  243. #define NS_IMAGE_LOAD                   (NS_STREAM_EVENT_START + 2)
  244. #define NS_IMAGE_ABORT                  (NS_STREAM_EVENT_START + 3)
  245. #define NS_IMAGE_ERROR                  (NS_STREAM_EVENT_START + 4)
  246. #define NS_SCRIPT_LOAD                  (NS_STREAM_EVENT_START + 5)
  247. #define NS_BEFORE_PAGE_UNLOAD           (NS_STREAM_EVENT_START + 6)
  248. #define NS_PAGE_RESTORE                 (NS_STREAM_EVENT_START + 7)
  249.  
  250. #define NS_FORM_EVENT_START             1200
  251. #define NS_FORM_SUBMIT                  (NS_FORM_EVENT_START)
  252. #define NS_FORM_RESET                   (NS_FORM_EVENT_START + 1)
  253. #define NS_FORM_CHANGE                  (NS_FORM_EVENT_START + 2)
  254. #define NS_FORM_SELECTED                (NS_FORM_EVENT_START + 3)
  255. #define NS_FORM_INPUT                   (NS_FORM_EVENT_START + 4)
  256.  
  257. //Need separate focus/blur notifications for non-native widgets
  258. #define NS_FOCUS_EVENT_START            1300
  259. #define NS_FOCUS_CONTENT                (NS_FOCUS_EVENT_START)
  260. #define NS_BLUR_CONTENT                 (NS_FOCUS_EVENT_START + 1)
  261.  
  262.  
  263. #define NS_DRAGDROP_EVENT_START         1400
  264. #define NS_DRAGDROP_ENTER               (NS_DRAGDROP_EVENT_START)
  265. #define NS_DRAGDROP_OVER                (NS_DRAGDROP_EVENT_START + 1)
  266. #define NS_DRAGDROP_EXIT                (NS_DRAGDROP_EVENT_START + 2)
  267. #define NS_DRAGDROP_DROP                (NS_DRAGDROP_EVENT_START + 3)
  268. #define NS_DRAGDROP_GESTURE             (NS_DRAGDROP_EVENT_START + 4)
  269. #define NS_DRAGDROP_OVER_SYNTH          (NS_DRAGDROP_EVENT_START + 1)
  270. #define NS_DRAGDROP_EXIT_SYNTH          (NS_DRAGDROP_EVENT_START + 2)
  271.  
  272. // Events for popups
  273. #define NS_XUL_EVENT_START            1500
  274. #define NS_XUL_POPUP_SHOWING          (NS_XUL_EVENT_START)
  275. #define NS_XUL_POPUP_SHOWN            (NS_XUL_EVENT_START+1)
  276. #define NS_XUL_POPUP_HIDING           (NS_XUL_EVENT_START+2)
  277. #define NS_XUL_POPUP_HIDDEN           (NS_XUL_EVENT_START+3)
  278. #define NS_XUL_COMMAND                (NS_XUL_EVENT_START+4)
  279. #define NS_XUL_BROADCAST              (NS_XUL_EVENT_START+5)
  280. #define NS_XUL_COMMAND_UPDATE         (NS_XUL_EVENT_START+6)
  281. #define NS_XUL_CLICK                  (NS_XUL_EVENT_START+7)
  282. //@}
  283.  
  284. // Scroll events
  285. #define NS_MOUSE_SCROLL_START         1600
  286. #define NS_MOUSE_SCROLL               (NS_MOUSE_SCROLL_START)
  287.  
  288. #define NS_SCROLLPORT_START           1700
  289. #define NS_SCROLLPORT_UNDERFLOW       (NS_SCROLLPORT_START)
  290. #define NS_SCROLLPORT_OVERFLOW        (NS_SCROLLPORT_START+1)
  291. #define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
  292.  
  293. // Mutation events defined elsewhere starting at 1800
  294.  
  295. // accessible events
  296. #define NS_ACCESSIBLE_START           1900
  297. #define NS_GETACCESSIBLE              (NS_ACCESSIBLE_START)
  298.  
  299. #define NS_USER_DEFINED_EVENT         2000
  300.  
  301. // custom OS events
  302. #define NS_APPCOMMAND_START           2100
  303. #define NS_APPCOMMAND                 (NS_APPCOMMAND_START)
  304. #define NS_APPCOMMAND_BACK            (NS_APPCOMMAND_START + 1)
  305. #define NS_APPCOMMAND_FORWARD         (NS_APPCOMMAND_START + 2)
  306. #define NS_APPCOMMAND_REFRESH         (NS_APPCOMMAND_START + 3)
  307. #define NS_APPCOMMAND_STOP            (NS_APPCOMMAND_START + 4)
  308. #define NS_APPCOMMAND_SEARCH          (NS_APPCOMMAND_START + 5)
  309. #define NS_APPCOMMAND_FAVORITES       (NS_APPCOMMAND_START + 6)
  310. #define NS_APPCOMMAND_HOME            (NS_APPCOMMAND_START + 7)
  311.  
  312. // composition events
  313. #define NS_COMPOSITION_EVENT_START    2200
  314. #define NS_COMPOSITION_START          (NS_COMPOSITION_EVENT_START)
  315. #define NS_COMPOSITION_END            (NS_COMPOSITION_EVENT_START + 1)
  316. #define NS_COMPOSITION_QUERY          (NS_COMPOSITION_EVENT_START + 2)
  317.  
  318. // reconversion events
  319. #define NS_RECONVERSION_START         2300
  320. #define NS_RECONVERSION_QUERY         (NS_RECONVERSION_START)
  321.  
  322. // text events
  323. #define NS_TEXT_START                 2400
  324. #define NS_TEXT_TEXT                  (NS_TEXT_START)
  325.  
  326. // UI events
  327. #define NS_UI_EVENT_START          2500
  328. // this is not to be confused with NS_ACTIVATE!
  329. #define NS_UI_ACTIVATE             (NS_UI_EVENT_START)
  330. #define NS_UI_FOCUSIN              (NS_UI_EVENT_START + 1)
  331. #define NS_UI_FOCUSOUT             (NS_UI_EVENT_START + 2)
  332.  
  333. // query caret rect events
  334. #define NS_QUERYCARETRECT_START    2600
  335. #define NS_QUERYCARETRECT          (NS_QUERYCARETRECT_START)
  336.  
  337. // pagetransition events
  338. #define NS_PAGETRANSITION_START    2700
  339. #define NS_PAGE_SHOW               (NS_PAGETRANSITION_START + 1)
  340. #define NS_PAGE_HIDE               (NS_PAGETRANSITION_START + 2)
  341.  
  342. #ifdef MOZ_SVG
  343. // SVG events
  344. #define NS_SVG_EVENT_START              2800
  345. #define NS_SVG_LOAD                     (NS_SVG_EVENT_START)
  346. #define NS_SVG_UNLOAD                   (NS_SVG_EVENT_START + 1)
  347. #define NS_SVG_ABORT                    (NS_SVG_EVENT_START + 2)
  348. #define NS_SVG_ERROR                    (NS_SVG_EVENT_START + 3)
  349. #define NS_SVG_RESIZE                   (NS_SVG_EVENT_START + 4)
  350. #define NS_SVG_SCROLL                   (NS_SVG_EVENT_START + 5)
  351.  
  352. // SVG Zoom events
  353. #define NS_SVGZOOM_EVENT_START          2900
  354. #define NS_SVG_ZOOM                     (NS_SVGZOOM_EVENT_START)
  355. #endif // MOZ_SVG
  356.  
  357. /**
  358.  * Return status for event processors, nsEventStatus, is defined in
  359.  * nsEvent.h.
  360.  */
  361.  
  362. /**
  363.  * sizemode is an adjunct to widget size
  364.  */
  365. enum nsSizeMode {
  366.   nsSizeMode_Normal = 0,
  367.   nsSizeMode_Minimized,
  368.   nsSizeMode_Maximized
  369. };
  370.  
  371. /**
  372.  * different types of (top-level) window z-level positioning
  373.  */
  374. enum nsWindowZ {
  375.   nsWindowZTop = 0,   // on top
  376.   nsWindowZBottom,    // on bottom
  377.   nsWindowZRelative   // just below some specified widget
  378. };
  379.  
  380. /**
  381.  * General event
  382.  */
  383.  
  384. class nsEvent
  385. {
  386. protected:
  387.   nsEvent(PRBool isTrusted, PRUint32 msg, PRUint8 structType)
  388.     : eventStructType(structType),
  389.       message(msg),
  390.       point(0, 0),
  391.       refPoint(0, 0),
  392.       time(0),
  393.       flags(0),
  394.       internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
  395.                        NS_APP_EVENT_FLAG_NONE),
  396.       userType(0)
  397.   {
  398.   }
  399.  
  400. public:
  401.   nsEvent(PRBool isTrusted, PRUint32 msg)
  402.     : eventStructType(NS_EVENT),
  403.       message(msg),
  404.       point(0, 0),
  405.       refPoint(0, 0),
  406.       time(0),
  407.       flags(0),
  408.       internalAppFlags(isTrusted ? NS_APP_EVENT_FLAG_TRUSTED :
  409.                        NS_APP_EVENT_FLAG_NONE),
  410.       userType(0)
  411.   {
  412.   }
  413.  
  414.   // See event struct types
  415.   PRUint8     eventStructType;
  416.   // See GUI MESSAGES,
  417.   PRUint32    message;              
  418.   // In widget relative coordinates, modified to be relative to
  419.   // current view in layout.
  420.   nsPoint     point;               
  421.   // In widget relative coordinates, not modified by layout code.
  422.   nsPoint     refPoint;               
  423.   // Elapsed time, in milliseconds, from the time the system was
  424.   // started to the time the message was created
  425.   PRUint32    time;      
  426.   // Flags to hold event flow stage and capture/bubble cancellation
  427.   // status
  428.   PRUint32    flags;
  429.   // Flags for indicating more event state for Mozilla applications.
  430.   PRUint32    internalAppFlags;
  431.   // Additional type info for user defined events
  432.   nsHashKey*  userType;
  433. };
  434.  
  435. /**
  436.  * General graphic user interface event
  437.  */
  438.  
  439. class nsGUIEvent : public nsEvent
  440. {
  441. protected:
  442.   nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w, PRUint8 structType)
  443.     : nsEvent(isTrusted, msg, structType),
  444.       widget(w), nativeMsg(nsnull)
  445.   {
  446.   }
  447.  
  448. public:
  449.   nsGUIEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  450.     : nsEvent(isTrusted, msg, NS_GUI_EVENT),
  451.       widget(w), nativeMsg(nsnull)
  452.   {
  453.   }
  454.  
  455.   /// Originator of the event
  456.   nsIWidget*  widget;           
  457.   /// Internal platform specific message.
  458.   void*     nativeMsg;        
  459. };
  460.  
  461. /**
  462.  * Script error event
  463.  */
  464.  
  465. class nsScriptErrorEvent : public nsEvent
  466. {
  467. public:
  468.   nsScriptErrorEvent(PRBool isTrusted, PRUint32 msg)
  469.     : nsEvent(isTrusted, msg, NS_SCRIPT_ERROR_EVENT),
  470.       lineNr(0), errorMsg(nsnull), fileName(nsnull)
  471.   {
  472.   }
  473.  
  474.   PRInt32           lineNr;
  475.   const PRUnichar*  errorMsg;
  476.   const PRUnichar*  fileName;
  477. };
  478.  
  479. class nsBeforePageUnloadEvent : public nsEvent
  480. {
  481. public:
  482.   nsBeforePageUnloadEvent(PRBool isTrusted, PRUint32 msg)
  483.     : nsEvent(isTrusted, msg, NS_BEFORE_PAGE_UNLOAD_EVENT)
  484.   {
  485.   }
  486.  
  487.   nsString text;
  488. };
  489.  
  490. /**
  491.  * Window resize event
  492.  */
  493.  
  494. class nsSizeEvent : public nsGUIEvent
  495. {
  496. public:
  497.   nsSizeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  498.     : nsGUIEvent(isTrusted, msg, w, NS_SIZE_EVENT),
  499.       windowSize(nsnull), mWinWidth(0), mWinHeight(0)
  500.   {
  501.   }
  502.  
  503.   /// x,y width, height in pixels (client area)
  504.   nsRect          *windowSize;    
  505.   /// width of entire window (in pixels)
  506.   PRInt32         mWinWidth;    
  507.   /// height of entire window (in pixels)
  508.   PRInt32         mWinHeight;    
  509. };
  510.  
  511. /**
  512.  * Window size mode event
  513.  */
  514.  
  515. class nsSizeModeEvent : public nsGUIEvent
  516. {
  517. public:
  518.   nsSizeModeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  519.     : nsGUIEvent(isTrusted, msg, w, NS_SIZEMODE_EVENT),
  520.       mSizeMode(nsSizeMode_Normal)
  521.   {
  522.   }
  523.  
  524.   nsSizeMode      mSizeMode;
  525. };
  526.  
  527. /**
  528.  * Window z-level event
  529.  */
  530.  
  531. class nsZLevelEvent : public nsGUIEvent
  532. {
  533. public:
  534.   nsZLevelEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  535.     : nsGUIEvent(isTrusted, msg, w, NS_ZLEVEL_EVENT),
  536.       mPlacement(nsWindowZTop), mReqBelow(nsnull), mActualBelow(nsnull),
  537.       mImmediate(PR_FALSE), mAdjusted(PR_FALSE)
  538.   {
  539.   }
  540.  
  541.   nsWindowZ  mPlacement;
  542.   nsIWidget *mReqBelow,    // widget we request being below, if any
  543.             *mActualBelow; // widget to be below, returned by handler
  544.   PRBool     mImmediate,   // handler should make changes immediately
  545.              mAdjusted;    // handler changed placement
  546. };
  547.  
  548. /**
  549.  * Window repaint event
  550.  */
  551.  
  552. class nsPaintEvent : public nsGUIEvent
  553. {
  554. public:
  555.   nsPaintEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  556.     : nsGUIEvent(isTrusted, msg, w, NS_PAINT_EVENT),
  557.       renderingContext(nsnull), region(nsnull), rect(nsnull)
  558.   {
  559.   }
  560.  
  561.   /// Context to paint in.
  562.   nsIRenderingContext *renderingContext;
  563.   /// area to paint  (should be used instead of rect)
  564.   nsIRegion           *region;
  565.   /// x,y, width, height in pixels of area to paint
  566.   nsRect              *rect;      
  567. };
  568.  
  569. /**
  570.  * Scrollbar event
  571.  */
  572.  
  573. class nsScrollbarEvent : public nsGUIEvent
  574. {
  575. public:
  576.   nsScrollbarEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  577.     : nsGUIEvent(isTrusted, msg, w, NS_SCROLLBAR_EVENT),
  578.       position(0)
  579.   {
  580.   }
  581.  
  582.   /// ranges between scrollbar 0 and (maxRange - thumbSize). See nsIScrollbar
  583.   PRUint32        position; 
  584. };
  585.  
  586. class nsScrollPortEvent : public nsGUIEvent
  587. {
  588. public:
  589.   enum orientType {
  590.     vertical   = 0,
  591.     horizontal = 1,
  592.     both       = 2
  593.   };
  594.  
  595.   nsScrollPortEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  596.     : nsGUIEvent(isTrusted, msg, w, NS_SCROLLPORT_EVENT),
  597.       orient(vertical)
  598.   {
  599.   }
  600.  
  601.   orientType orient;
  602. };
  603.  
  604. class nsInputEvent : public nsGUIEvent
  605. {
  606. protected:
  607.   nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
  608.                PRUint8 structType)
  609.     : nsGUIEvent(isTrusted, msg, w, structType),
  610.       isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
  611.   {
  612.   }
  613.  
  614. public:
  615.   nsInputEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  616.     : nsGUIEvent(isTrusted, msg, w, NS_INPUT_EVENT),
  617.       isShift(PR_FALSE), isControl(PR_FALSE), isAlt(PR_FALSE), isMeta(PR_FALSE)
  618.   {
  619.   }
  620.  
  621.   /// PR_TRUE indicates the shift key is down
  622.   PRBool          isShift;        
  623.   /// PR_TRUE indicates the control key is down
  624.   PRBool          isControl;      
  625.   /// PR_TRUE indicates the alt key is down
  626.   PRBool          isAlt;          
  627.   /// PR_TRUE indicates the meta key is down (or, on Mac, the Command key)
  628.   PRBool          isMeta;
  629. };
  630.  
  631. /**
  632.  * Mouse event
  633.  */
  634.  
  635. class nsMouseEvent : public nsInputEvent
  636. {
  637. public:
  638.   enum reasonType { eReal, eSynthesized };
  639.  
  640.   nsMouseEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w,
  641.                reasonType aReason)
  642.     : nsInputEvent(isTrusted, msg, w, NS_MOUSE_EVENT),
  643.       clickCount(0), acceptActivation(PR_FALSE), reason(aReason)
  644.   {
  645.     if (msg == NS_MOUSE_MOVE) {
  646.       flags |= NS_EVENT_FLAG_CANT_CANCEL;
  647.     }
  648.   }
  649.  
  650.   /// The number of mouse clicks
  651.   PRUint32        clickCount;          
  652.   /// Special return code for MOUSE_ACTIVATE to signal
  653.   /// if the target accepts activation (1), or denies it (0)
  654.   PRPackedBool    acceptActivation;           
  655.   reasonType      reason : 8;
  656. };
  657.  
  658. /**
  659.  * Accessible event
  660.  */
  661.  
  662. class nsAccessibleEvent : public nsInputEvent
  663. {
  664. public:
  665.   nsAccessibleEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  666.     : nsInputEvent(isTrusted, msg, w, NS_ACCESSIBLE_EVENT),
  667.       accessible(nsnull)
  668.   {
  669.   }
  670.  
  671.   nsIAccessible*  accessible;     
  672. };
  673.  
  674. /**
  675.  * Keyboard event
  676.  */
  677.  
  678. class nsKeyEvent : public nsInputEvent
  679. {
  680. public:
  681.   nsKeyEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  682.     : nsInputEvent(isTrusted, msg, w, NS_KEY_EVENT),
  683.       keyCode(0), charCode(0), isChar(0)
  684.   {
  685.   }
  686.  
  687.   /// see NS_VK codes
  688.   PRUint32        keyCode;   
  689.   /// OS translated Unicode char
  690.   PRUint32        charCode;
  691.   // indicates whether the event signifies a printable character
  692.   PRBool          isChar;
  693. };
  694.  
  695. /**
  696.  * IME Related Events
  697.  */
  698. struct nsTextRange
  699. {
  700.   nsTextRange()
  701.     : mStartOffset(0), mEndOffset(0), mRangeType(0)
  702.   {
  703.   }
  704.  
  705.   PRUint32 mStartOffset;
  706.   PRUint32 mEndOffset;
  707.   PRUint32 mRangeType;
  708. };
  709.  
  710. typedef nsTextRange* nsTextRangeArray;
  711.  
  712. struct nsTextEventReply
  713. {
  714.   nsTextEventReply()
  715.     : mCursorIsCollapsed(PR_FALSE)
  716.   {
  717.   }
  718.  
  719.   nsRect mCursorPosition;
  720.   PRBool mCursorIsCollapsed;
  721. };
  722.  
  723. typedef struct nsTextEventReply nsTextEventReply;
  724.  
  725. class nsTextEvent : public nsInputEvent
  726. {
  727. public:
  728.   nsTextEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  729.     : nsInputEvent(isTrusted, msg, w, NS_TEXT_EVENT),
  730.       theText(nsnull), rangeCount(0), rangeArray(nsnull), isChar(PR_FALSE)
  731.   {
  732.   }
  733.  
  734.   const PRUnichar*  theText;
  735.   nsTextEventReply  theReply;
  736.   PRUint32          rangeCount;
  737.   nsTextRangeArray  rangeArray;
  738.   PRBool            isChar;
  739. };
  740.  
  741. class nsCompositionEvent : public nsInputEvent
  742. {
  743. public:
  744.   nsCompositionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  745.     : nsInputEvent(isTrusted, msg, w, NS_COMPOSITION_EVENT)
  746.   {
  747.   }
  748.  
  749.   nsTextEventReply theReply;
  750. };
  751.  
  752. class nsMouseScrollEvent : public nsInputEvent
  753. {
  754. public:
  755.   enum nsMouseScrollFlags {
  756.     kIsFullPage =   1 << 0,
  757.     kIsVertical =   1 << 1,
  758.     kIsHorizontal = 1 << 2
  759.   };
  760.  
  761.   nsMouseScrollEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  762.     : nsInputEvent(isTrusted, msg, w, NS_MOUSE_SCROLL_EVENT),
  763.       scrollFlags(0), delta(0)
  764.   {
  765.   }
  766.  
  767.   PRInt32 scrollFlags;
  768.   PRInt32 delta;
  769. };
  770.  
  771. struct nsReconversionEventReply {
  772.   nsReconversionEventReply()
  773.     : mReconversionString(nsnull)
  774.   {
  775.   }
  776.  
  777.   PRUnichar *mReconversionString;
  778. };
  779.  
  780. class nsReconversionEvent : public nsInputEvent
  781. {
  782. public:
  783.   nsReconversionEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  784.     : nsInputEvent(isTrusted, msg, w, NS_RECONVERSION_EVENT)
  785.   {
  786.   }
  787.  
  788.   nsReconversionEventReply  theReply;
  789. };
  790.  
  791. struct nsQueryCaretRectEventReply
  792. {
  793.   nsQueryCaretRectEventReply()
  794.     : mRectIsValid(PR_FALSE)
  795.   {
  796.   }
  797.  
  798.   PRBool mRectIsValid;
  799.   nsRect mCaretRect;
  800. };
  801.  
  802. class nsQueryCaretRectEvent : public nsInputEvent
  803. {
  804. public:
  805.   nsQueryCaretRectEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  806.     : nsInputEvent(isTrusted, msg, w, NS_QUERYCARETRECT_EVENT)
  807.   {
  808.   }
  809.  
  810.   nsQueryCaretRectEventReply theReply;
  811. };
  812.  
  813. /**
  814.  * MenuItem event
  815.  * 
  816.  * When this event occurs the widget field in nsGUIEvent holds the "target"
  817.  * for the event
  818.  */
  819.  
  820. class nsMenuEvent : public nsGUIEvent
  821. {
  822. public:
  823.   nsMenuEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  824.     : nsGUIEvent(isTrusted, msg, w, NS_MENU_EVENT),
  825.       mMenuItem(nsnull), mCommand(0)
  826.   {
  827.   }
  828.  
  829.   nsIMenuItem * mMenuItem;
  830.   PRUint32      mCommand;
  831. };
  832.  
  833. /**
  834.  * Form event
  835.  * 
  836.  * We hold the originating form control for form submit and reset events.
  837.  * originator is a weak pointer (does not hold a strong reference).
  838.  */
  839.  
  840. class nsFormEvent : public nsEvent
  841. {
  842. public:
  843.   nsFormEvent(PRBool isTrusted, PRUint32 msg)
  844.     : nsEvent(isTrusted, msg, NS_FORM_EVENT),
  845.       originator(nsnull)
  846.   {
  847.   }
  848.  
  849.   nsIContent *originator;
  850. };
  851.  
  852. /**
  853. * Focus event
  854. */
  855. class nsFocusEvent : public nsGUIEvent
  856. {
  857. public:
  858.   nsFocusEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  859.     : nsGUIEvent(isTrusted, msg, w, NS_FOCUS_EVENT),
  860.       isMozWindowTakingFocus(PR_FALSE)
  861.   {
  862.   }
  863.  
  864.   PRBool isMozWindowTakingFocus;
  865. };
  866.  
  867. /**
  868.  * App Command event
  869.  *
  870.  * Custom commands from the operating system.  eg. WM_APPCOMMAND on Windows
  871.  */
  872.  
  873. class nsAppCommandEvent : public nsInputEvent
  874. {
  875. public:
  876.   nsAppCommandEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
  877.     : nsInputEvent(isTrusted, msg, w, NS_APPCOMMAND_EVENT),
  878.       appCommand(0)
  879.   {
  880.   }
  881.  
  882.   PRUint32     appCommand;
  883. };
  884.  
  885. /**
  886.  * blocked popup window event
  887.  */
  888. class nsPopupBlockedEvent : public nsEvent
  889. {
  890. public:
  891.   nsPopupBlockedEvent(PRBool isTrusted, PRUint32 msg)
  892.     : nsEvent(isTrusted, msg, NS_POPUPBLOCKED_EVENT),
  893.       mRequestingWindowURI(nsnull), mPopupWindowURI(nsnull)
  894.   {
  895.   }
  896.  
  897.   nsIURI* mRequestingWindowURI; // owning reference
  898.   nsIURI* mPopupWindowURI;      // owning reference
  899.   nsString mPopupWindowFeatures;
  900. };
  901.  
  902. /**
  903.  * DOM UIEvent
  904.  */
  905. class nsUIEvent : public nsEvent
  906. {
  907. public:
  908.   nsUIEvent(PRBool isTrusted, PRUint32 msg, PRInt32 d)
  909.     : nsEvent(isTrusted, msg, NS_UI_EVENT),
  910.       detail(d)
  911.   {
  912.   }
  913.  
  914.   PRInt32 detail;
  915. };
  916.  
  917. /**
  918.  * PageTransition event
  919.  */
  920. class nsPageTransitionEvent : public nsEvent
  921. {
  922. public:
  923.   nsPageTransitionEvent(PRBool isTrusted, PRUint32 msg, PRBool p)
  924.     : nsEvent(isTrusted, msg, NS_PAGETRANSITION_EVENT),
  925.       persisted(p)
  926.   {
  927.   }
  928.  
  929.   PRBool persisted;
  930. };
  931.  
  932. /**
  933.  * Event status for D&D Event
  934.  */
  935. enum nsDragDropEventStatus {  
  936.   /// The event is a enter
  937.   nsDragDropEventStatus_eDragEntered,            
  938.   /// The event is exit
  939.   nsDragDropEventStatus_eDragExited, 
  940.   /// The event is drop
  941.   nsDragDropEventStatus_eDrop  
  942. };
  943.  
  944.  
  945. #define NS_IS_MOUSE_EVENT(evnt) \
  946.        (((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
  947.         ((evnt)->message == NS_MOUSE_LEFT_BUTTON_UP) || \
  948.         ((evnt)->message == NS_MOUSE_LEFT_CLICK) || \
  949.         ((evnt)->message == NS_MOUSE_LEFT_DOUBLECLICK) || \
  950.         ((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) || \
  951.         ((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_UP) || \
  952.         ((evnt)->message == NS_MOUSE_MIDDLE_CLICK) || \
  953.         ((evnt)->message == NS_MOUSE_MIDDLE_DOUBLECLICK) || \
  954.         ((evnt)->message == NS_MOUSE_RIGHT_BUTTON_DOWN) || \
  955.         ((evnt)->message == NS_MOUSE_RIGHT_BUTTON_UP) || \
  956.         ((evnt)->message == NS_MOUSE_RIGHT_CLICK) || \
  957.         ((evnt)->message == NS_MOUSE_RIGHT_DOUBLECLICK) || \
  958.         ((evnt)->message == NS_MOUSE_ENTER) || \
  959.         ((evnt)->message == NS_MOUSE_EXIT) || \
  960.         ((evnt)->message == NS_MOUSE_ENTER) || \
  961.         ((evnt)->message == NS_MOUSE_EXIT) || \
  962.         ((evnt)->message == NS_MOUSE_ENTER_SYNTH) || \
  963.         ((evnt)->message == NS_MOUSE_EXIT_SYNTH) || \
  964.         ((evnt)->message == NS_MOUSE_MOVE))
  965.  
  966. #define NS_IS_DRAG_EVENT(evnt) \
  967.        (((evnt)->message == NS_DRAGDROP_ENTER) || \
  968.         ((evnt)->message == NS_DRAGDROP_OVER) || \
  969.         ((evnt)->message == NS_DRAGDROP_EXIT) || \
  970.         ((evnt)->message == NS_DRAGDROP_DROP) || \
  971.         ((evnt)->message == NS_DRAGDROP_GESTURE) || \
  972.         ((evnt)->message == NS_DRAGDROP_OVER_SYNTH) || \
  973.         ((evnt)->message == NS_DRAGDROP_EXIT_SYNTH))
  974.  
  975. #define NS_IS_KEY_EVENT(evnt) \
  976.        (((evnt)->message == NS_KEY_DOWN) ||  \
  977.         ((evnt)->message == NS_KEY_PRESS) || \
  978.         ((evnt)->message == NS_KEY_UP))
  979.  
  980. #define NS_IS_IME_EVENT(evnt) \
  981.        (((evnt)->message == NS_TEXT_TEXT) ||  \
  982.         ((evnt)->message == NS_COMPOSITION_START) ||  \
  983.         ((evnt)->message == NS_COMPOSITION_END) || \
  984.         ((evnt)->message == NS_RECONVERSION_QUERY) || \
  985.         ((evnt)->message == NS_QUERYCARETRECT) || \
  986.         ((evnt)->message == NS_COMPOSITION_QUERY))
  987.  
  988. #define NS_IS_FOCUS_EVENT(evnt) \
  989.        (((evnt)->message == NS_GOTFOCUS) ||  \
  990.         ((evnt)->message == NS_LOSTFOCUS) ||  \
  991.         ((evnt)->message == NS_ACTIVATE) || \
  992.         ((evnt)->message == NS_DEACTIVATE) || \
  993.         ((evnt)->message == NS_PLUGIN_ACTIVATE))
  994.  
  995. #define NS_IS_TRUSTED_EVENT(event) \
  996.   (((event)->internalAppFlags & NS_APP_EVENT_FLAG_TRUSTED) != 0)
  997.  
  998. // Mark an event as being dispatching.
  999. #define NS_MARK_EVENT_DISPATCH_STARTED(event) \
  1000.   (event)->flags |= NS_EVENT_FLAG_DISPATCHING;
  1001.  
  1002. #define NS_IS_EVENT_IN_DISPATCH(event) \
  1003.   (((event)->flags & NS_EVENT_FLAG_DISPATCHING) != 0)
  1004.  
  1005. // Mark an event as being done dispatching.
  1006. #define NS_MARK_EVENT_DISPATCH_DONE(event) \
  1007.   NS_ASSERTION(NS_IS_EVENT_IN_DISPATCH(event), \
  1008.                "Event never got marked for dispatch!"); \
  1009.   (event)->flags &= ~NS_EVENT_FLAG_DISPATCHING; \
  1010.   (event)->flags |= NS_EVENT_FLAG_STOP_DISPATCH_IMMEDIATELY;
  1011.  
  1012. /*
  1013.  * Virtual key bindings for keyboard events.
  1014.  * These come from nsIDOMKeyEvent.h, which is generated from MouseKeyEvent.idl.
  1015.  * Really, it would be better if we phased out the NS_VK symbols altogether
  1016.  * in favor of the DOM ones, but at least this way they'll be in sync.
  1017.  */
  1018.  
  1019. #define NS_VK_CANCEL         nsIDOMKeyEvent::DOM_VK_CANCEL
  1020. #define NS_VK_BACK           nsIDOMKeyEvent::DOM_VK_BACK_SPACE
  1021. #define NS_VK_TAB            nsIDOMKeyEvent::DOM_VK_TAB
  1022. #define NS_VK_CLEAR          nsIDOMKeyEvent::DOM_VK_CLEAR
  1023. #define NS_VK_RETURN         nsIDOMKeyEvent::DOM_VK_RETURN
  1024. #define NS_VK_ENTER          nsIDOMKeyEvent::DOM_VK_ENTER
  1025. #define NS_VK_SHIFT          nsIDOMKeyEvent::DOM_VK_SHIFT
  1026. #define NS_VK_CONTROL        nsIDOMKeyEvent::DOM_VK_CONTROL
  1027. #define NS_VK_ALT            nsIDOMKeyEvent::DOM_VK_ALT
  1028. #define NS_VK_PAUSE          nsIDOMKeyEvent::DOM_VK_PAUSE
  1029. #define NS_VK_CAPS_LOCK      nsIDOMKeyEvent::DOM_VK_CAPS_LOCK
  1030. #define NS_VK_ESCAPE         nsIDOMKeyEvent::DOM_VK_ESCAPE
  1031. #define NS_VK_SPACE          nsIDOMKeyEvent::DOM_VK_SPACE
  1032. #define NS_VK_PAGE_UP        nsIDOMKeyEvent::DOM_VK_PAGE_UP
  1033. #define NS_VK_PAGE_DOWN      nsIDOMKeyEvent::DOM_VK_PAGE_DOWN
  1034. #define NS_VK_END            nsIDOMKeyEvent::DOM_VK_END
  1035. #define NS_VK_HOME           nsIDOMKeyEvent::DOM_VK_HOME
  1036. #define NS_VK_LEFT           nsIDOMKeyEvent::DOM_VK_LEFT
  1037. #define NS_VK_UP             nsIDOMKeyEvent::DOM_VK_UP
  1038. #define NS_VK_RIGHT          nsIDOMKeyEvent::DOM_VK_RIGHT
  1039. #define NS_VK_DOWN           nsIDOMKeyEvent::DOM_VK_DOWN
  1040. #define NS_VK_PRINTSCREEN    nsIDOMKeyEvent::DOM_VK_PRINTSCREEN
  1041. #define NS_VK_INSERT         nsIDOMKeyEvent::DOM_VK_INSERT
  1042. #define NS_VK_DELETE         nsIDOMKeyEvent::DOM_VK_DELETE
  1043.  
  1044. // NS_VK_0 - NS_VK_9 match their ascii values
  1045. #define NS_VK_0              nsIDOMKeyEvent::DOM_VK_0
  1046. #define NS_VK_1              nsIDOMKeyEvent::DOM_VK_1
  1047. #define NS_VK_2              nsIDOMKeyEvent::DOM_VK_2
  1048. #define NS_VK_3              nsIDOMKeyEvent::DOM_VK_3
  1049. #define NS_VK_4              nsIDOMKeyEvent::DOM_VK_4
  1050. #define NS_VK_5              nsIDOMKeyEvent::DOM_VK_5
  1051. #define NS_VK_6              nsIDOMKeyEvent::DOM_VK_6
  1052. #define NS_VK_7              nsIDOMKeyEvent::DOM_VK_7
  1053. #define NS_VK_8              nsIDOMKeyEvent::DOM_VK_8
  1054. #define NS_VK_9              nsIDOMKeyEvent::DOM_VK_9
  1055.  
  1056. #define NS_VK_SEMICOLON      nsIDOMKeyEvent::DOM_VK_SEMICOLON
  1057. #define NS_VK_EQUALS         nsIDOMKeyEvent::DOM_VK_EQUALS
  1058.  
  1059. // NS_VK_A - NS_VK_Z match their ascii values
  1060. #define NS_VK_A              nsIDOMKeyEvent::DOM_VK_A
  1061. #define NS_VK_B              nsIDOMKeyEvent::DOM_VK_B
  1062. #define NS_VK_C              nsIDOMKeyEvent::DOM_VK_C
  1063. #define NS_VK_D              nsIDOMKeyEvent::DOM_VK_D
  1064. #define NS_VK_E              nsIDOMKeyEvent::DOM_VK_E
  1065. #define NS_VK_F              nsIDOMKeyEvent::DOM_VK_F
  1066. #define NS_VK_G              nsIDOMKeyEvent::DOM_VK_G
  1067. #define NS_VK_H              nsIDOMKeyEvent::DOM_VK_H
  1068. #define NS_VK_I              nsIDOMKeyEvent::DOM_VK_I
  1069. #define NS_VK_J              nsIDOMKeyEvent::DOM_VK_J
  1070. #define NS_VK_K              nsIDOMKeyEvent::DOM_VK_K
  1071. #define NS_VK_L              nsIDOMKeyEvent::DOM_VK_L
  1072. #define NS_VK_M              nsIDOMKeyEvent::DOM_VK_M
  1073. #define NS_VK_N              nsIDOMKeyEvent::DOM_VK_N
  1074. #define NS_VK_O              nsIDOMKeyEvent::DOM_VK_O
  1075. #define NS_VK_P              nsIDOMKeyEvent::DOM_VK_P
  1076. #define NS_VK_Q              nsIDOMKeyEvent::DOM_VK_Q
  1077. #define NS_VK_R              nsIDOMKeyEvent::DOM_VK_R
  1078. #define NS_VK_S              nsIDOMKeyEvent::DOM_VK_S
  1079. #define NS_VK_T              nsIDOMKeyEvent::DOM_VK_T
  1080. #define NS_VK_U              nsIDOMKeyEvent::DOM_VK_U
  1081. #define NS_VK_V              nsIDOMKeyEvent::DOM_VK_V
  1082. #define NS_VK_W              nsIDOMKeyEvent::DOM_VK_W
  1083. #define NS_VK_X              nsIDOMKeyEvent::DOM_VK_X
  1084. #define NS_VK_Y              nsIDOMKeyEvent::DOM_VK_Y
  1085. #define NS_VK_Z              nsIDOMKeyEvent::DOM_VK_Z
  1086.  
  1087. #define NS_VK_CONTEXT_MENU   nsIDOMKeyEvent::DOM_VK_CONTEXT_MENU
  1088.  
  1089. #define NS_VK_NUMPAD0        nsIDOMKeyEvent::DOM_VK_NUMPAD0
  1090. #define NS_VK_NUMPAD1        nsIDOMKeyEvent::DOM_VK_NUMPAD1
  1091. #define NS_VK_NUMPAD2        nsIDOMKeyEvent::DOM_VK_NUMPAD2
  1092. #define NS_VK_NUMPAD3        nsIDOMKeyEvent::DOM_VK_NUMPAD3
  1093. #define NS_VK_NUMPAD4        nsIDOMKeyEvent::DOM_VK_NUMPAD4
  1094. #define NS_VK_NUMPAD5        nsIDOMKeyEvent::DOM_VK_NUMPAD5
  1095. #define NS_VK_NUMPAD6        nsIDOMKeyEvent::DOM_VK_NUMPAD6
  1096. #define NS_VK_NUMPAD7        nsIDOMKeyEvent::DOM_VK_NUMPAD7
  1097. #define NS_VK_NUMPAD8        nsIDOMKeyEvent::DOM_VK_NUMPAD8
  1098. #define NS_VK_NUMPAD9        nsIDOMKeyEvent::DOM_VK_NUMPAD9
  1099. #define NS_VK_MULTIPLY       nsIDOMKeyEvent::DOM_VK_MULTIPLY
  1100. #define NS_VK_ADD            nsIDOMKeyEvent::DOM_VK_ADD
  1101. #define NS_VK_SEPARATOR      nsIDOMKeyEvent::DOM_VK_SEPARATOR
  1102. #define NS_VK_SUBTRACT       nsIDOMKeyEvent::DOM_VK_SUBTRACT
  1103. #define NS_VK_DECIMAL        nsIDOMKeyEvent::DOM_VK_DECIMAL
  1104. #define NS_VK_DIVIDE         nsIDOMKeyEvent::DOM_VK_DIVIDE
  1105. #define NS_VK_F1             nsIDOMKeyEvent::DOM_VK_F1
  1106. #define NS_VK_F2             nsIDOMKeyEvent::DOM_VK_F2
  1107. #define NS_VK_F3             nsIDOMKeyEvent::DOM_VK_F3
  1108. #define NS_VK_F4             nsIDOMKeyEvent::DOM_VK_F4
  1109. #define NS_VK_F5             nsIDOMKeyEvent::DOM_VK_F5
  1110. #define NS_VK_F6             nsIDOMKeyEvent::DOM_VK_F6
  1111. #define NS_VK_F7             nsIDOMKeyEvent::DOM_VK_F7
  1112. #define NS_VK_F8             nsIDOMKeyEvent::DOM_VK_F8
  1113. #define NS_VK_F9             nsIDOMKeyEvent::DOM_VK_F9
  1114. #define NS_VK_F10            nsIDOMKeyEvent::DOM_VK_F10
  1115. #define NS_VK_F11            nsIDOMKeyEvent::DOM_VK_F11
  1116. #define NS_VK_F12            nsIDOMKeyEvent::DOM_VK_F12
  1117. #define NS_VK_F13            nsIDOMKeyEvent::DOM_VK_F13
  1118. #define NS_VK_F14            nsIDOMKeyEvent::DOM_VK_F14
  1119. #define NS_VK_F15            nsIDOMKeyEvent::DOM_VK_F15
  1120. #define NS_VK_F16            nsIDOMKeyEvent::DOM_VK_F16
  1121. #define NS_VK_F17            nsIDOMKeyEvent::DOM_VK_F17
  1122. #define NS_VK_F18            nsIDOMKeyEvent::DOM_VK_F18
  1123. #define NS_VK_F19            nsIDOMKeyEvent::DOM_VK_F19
  1124. #define NS_VK_F20            nsIDOMKeyEvent::DOM_VK_F20
  1125. #define NS_VK_F21            nsIDOMKeyEvent::DOM_VK_F21
  1126. #define NS_VK_F22            nsIDOMKeyEvent::DOM_VK_F22
  1127. #define NS_VK_F23            nsIDOMKeyEvent::DOM_VK_F23
  1128. #define NS_VK_F24            nsIDOMKeyEvent::DOM_VK_F24
  1129.  
  1130. #define NS_VK_NUM_LOCK       nsIDOMKeyEvent::DOM_VK_NUM_LOCK
  1131. #define NS_VK_SCROLL_LOCK    nsIDOMKeyEvent::DOM_VK_SCROLL_LOCK
  1132.  
  1133. #define NS_VK_COMMA          nsIDOMKeyEvent::DOM_VK_COMMA
  1134. #define NS_VK_PERIOD         nsIDOMKeyEvent::DOM_VK_PERIOD
  1135. #define NS_VK_SLASH          nsIDOMKeyEvent::DOM_VK_SLASH
  1136. #define NS_VK_BACK_QUOTE     nsIDOMKeyEvent::DOM_VK_BACK_QUOTE
  1137. #define NS_VK_OPEN_BRACKET   nsIDOMKeyEvent::DOM_VK_OPEN_BRACKET
  1138. #define NS_VK_BACK_SLASH     nsIDOMKeyEvent::DOM_VK_BACK_SLASH
  1139. #define NS_VK_CLOSE_BRACKET  nsIDOMKeyEvent::DOM_VK_CLOSE_BRACKET
  1140. #define NS_VK_QUOTE          nsIDOMKeyEvent::DOM_VK_QUOTE
  1141.  
  1142. #define NS_VK_META           nsIDOMKeyEvent::DOM_VK_META
  1143.  
  1144. // IME Constants  -- keep in synch with nsIDOMTextRange.h
  1145. #define NS_TEXTRANGE_CARETPOSITION                0x01
  1146. #define NS_TEXTRANGE_RAWINPUT                    0X02
  1147. #define NS_TEXTRANGE_SELECTEDRAWTEXT            0x03
  1148. #define NS_TEXTRANGE_CONVERTEDTEXT                0x04
  1149. #define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT        0x05
  1150.  
  1151. #endif // nsGUIEvent_h__
  1152.